package com.joshluisaac.jacksonlearning;

import java.io.File;
import java.io.IOException;

import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;

//Read JSON string from file “user.json“, and convert it back to Java object.

public class JacksonJsonToJavaObject {

	/**
	 * @param args
	 * @throws IOException
	 * @throws JsonMappingException
	 * @throws JsonParseException
	 */
	public static void main(String[] args) throws JsonParseException,
			JsonMappingException, IOException {

		ObjectMapper mapper = new ObjectMapper();

		User user = mapper.readValue(new File("user.json"), User.class);

		System.out.println(user);

	}

}
